<!doctype html> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8" />
    <title>快速初始化-显示加载的图片</title>
    <script src="//cdn.jsdelivr.net/npm/phaser@3.11.0/dist/phaser.js"></script>
    <style type="text/css">
        body {
            margin: 0;
        }
    </style>
</head>
<body>

<script type="text/javascript">

	var config = {
		type: Phaser.AUTO,
		width: 800,
		height: 600,
		physics: {
			default: 'arcade',
			arcade: {
				gravity: { y: 0 },
				debug: false
			}
		},
		scene: {
			preload: preload,
			create: create,
			update: update
		}
	};
	//初始化
	var game = new Phaser.Game(config);
	var doors;
	//预加载图片或者资源
    function preload ()
    {
		this.load.image('sky', './assets/sky.png');
		//此处的money.png一定要是序列帧png
		this.load.image('monkey','./assets/monkey.png');
		this.load.image('door','./assets/door.png');
    }

	//显示预加载的资源或者图片
    function create ()
    {
		this.add.image(400, 300, 'sky');
		
		doors = this.physics.add.staticGroup();
		platforms.create(200, 100, 'door');
		
		
		//比如要在游戏里控制一个猴子
		player = this.physics.add.sprite(100, 250, 'monkey');
		//反弹系数
		player.setBounce(0);
		//游戏画布边间是否反弹
		player.setCollideWorldBounds(true);
		
		//本节重点代码
		this.physics.add.collider(player, doors);
		
		this.physics.add.overlap(player, doors, function(){
			//todo 如果重合执行的回调函数
		}, null, this);
	

	//每帧都要调用的方法
    function update ()
    {


    }

</script>

</body>
</html>